-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optionally treat digits as capitals when converting to snake case #417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like this idea. I debated the best way to handle numbers, it will be good to have both options.
Will you also add a test to test_camel_converter.py
for this? You could either tweak the test_to_snake
test or test this one in its own test, either way would be fine.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #417 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 97 101 +4
=========================================
+ Hits 97 101 +4
☔ View full report in Codecov by Sentry. |
Co-authored-by: Paul Sanders <psanders1@gmail.com>
OK, I will update the test suite |
This is done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
Thanks for creating this, it's very useful
However, I discovered when using your package that I needed a slight variant on the
to_snake()
function. Specifically, I needed a camel case string likemyVariable2
to be converted tomy_variable_2
rather thanmy_variable2
, so I tweaked your function to allow this. (The default behaviour remains the same so this should be backwards compatible)Figured I should offer it back in case it is of use to other people. Feel free to take or leave it